import { RouterModule, Routes } from '@angular/router'

import { HomeComponent } from './home.component'
import { IndexComponent } from './index/index.component'
import { SelectCityComponent } from './select-city/select-city.component'
import { EstateMapComponent } from './estate-map/estate-map.component'
import { SearchComponent } from './search/search.component'
import { SearchResultComponent } from './search-result/search-result.component'
import { QuotationComponent } from './quotation/quotation.component'
import { ActivityComponent } from './activity/activity.component'
import { ActivityDetailComponent } from './activity-detail/activity-detail.component'
import { ActivitySignupComponent } from './activity-signup/activity-signup.component'

const appRoutes: Routes = [
  {
    path: '',
    component: HomeComponent,
    children: [
      {
        path: '',
        children: [
          { path: '', redirectTo: 'index', pathMatch: 'full' },
          { path: 'index', component: IndexComponent, data: { title: '房乐美', depth: 1 } },
          { path: 'selectCity', component: SelectCityComponent, data: { title: '切换城市', depth: 2 } },
          { path: 'estateMap', component: EstateMapComponent, data: { title: '地图', depth: 2 } },
          { path: 'search', component: SearchComponent, data: { title: '搜索', depth: 2 } },
          { path: 'searchResult', component: SearchResultComponent, data: { title: '搜索', depth: 3 } },
          { path: 'quotation', component: QuotationComponent, data: { title: '房市行情', depth: 2 } },
          { path: 'activity', component: ActivityComponent, data: { title: '活动列表', depth: 4 } },
          { path: 'activityDetail', component: ActivityDetailComponent, data: { title: '活动详情', depth: 5 } },
          { path: 'activitySignup', component: ActivitySignupComponent, data: { title: '活动报名', depth: 6 } }
        ]
      }
    ]
  }
]

export const router = RouterModule.forChild(appRoutes)
